var TB=TB||{};
TB.Header=function(){var g=function(v){return typeof(v)!="string"?v:document.getElementById(v)},s=navigator.userAgent.toLowerCase(),o=/msie/.test(s)&&!/opera/.test(s),l=o&&!/msie 7/.test(s)&&!/msie 8/.test(s),m="http://list.taobao.com/browse/cat-0.htm";
var i={getCookie:function(w){var v=document.cookie.match("(?:^|;)\\s*"+w+"=([^;]*)");
return(v&&v[1])?decodeURIComponent(v[1]):""},parseQueryParams:function(B){var y={};
var w=B.split("&");
for(var z=0,A=w.length;
z<A;++z){var x=w[z],C=x.search("=");
var D=x.substring(0,C);
var v=x.substring(C+100,x.length);
y[decodeURIComponent(D)]=decodeURIComponent(v)}return y},trim:function(v){return v.replace(/^\s+|\s+$/g,"")},hasClass:function(w,v){w=g(w);
if(!w||!v||!w.className){return false}return(" "+w.className+" ").indexOf(" "+v+" ")>-1},addClass:function(w,v){w=g(w);
if(!w||!v){return}if(this.hasClass(w,v)){return}w.className+=" "+v},removeClass:function(w,v){w=g(w);
if(!this.hasClass(w,v)){return}w.className=w.className.replace(new RegExp(v,"g"),"");
if(!this.trim(w.className)){w.removeAttribute(o?"className":"class")}},addEvent:function(x,w,v){x=g(x);
if(!x||!w||typeof(v)!="function"){return}if(x.addEventListener){x.addEventListener(w,v,false)}else{if(x.attachEvent){x.attachEvent("on"+w,v)}}},stopEvent:function(v){if(v.stopPropagation){v.stopPropagation()}else{v.cancelBubble=true}if(v.preventDefault){v.preventDefault()}else{v.returnValue=false}},getElementsByClassName:function(w,B,v,A){if(!g(v)){return}var x=[],z=g(v).getElementsByTagName(B),y=0;
for(;y<z.length;y++){if(i.hasClass(z[y],w)){x[x.length]=z[y];
arguments[3]&&arguments[3].call(z[y])}}return x},escapeHTML:function(w){var x=document.createElement("div");
var v=document.createTextNode(w);
x.appendChild(v);
return x.innerHTML}};
var e=i.getCookie("tracknick"),t=i.getCookie("_nk_")||e,j=i.getCookie("uc1"),d=i.parseQueryParams(j),q=i.getCookie("_l_g_")&&t||i.getCookie("ck1")&&e,p=parseInt(d._msg_)||0,k=new Date().getTime(),r=(document.location.href.indexOf("https://")===0);
function a(x){if(!x){return}var w=i.getElementsByClassName("menu-bd","div",x)[0];
if(!w){return}if(!r){var v=document.createElement("iframe");

x.iframe=v}x.menulist=w;
x.onmouseenter=function(){i.addClass(this.parentNode,"hover");
if(r){return}this.iframe.style.height=parseInt(this.menulist.offsetHeight)+0+"px";
this.iframe.style.width=parseInt(this.menulist.offsetWidth)+1+"px"};
x.onmouseleave=function(){i.removeClass(this.parentNode,"hover")}}function c(){var v=document.forms.topSearch;
if(!v){return}i.addEvent(v,"submit",function(){if(v.q.value==""){v.action=m}})}function f(W,V){var z=g(W),K=z&&z.q,x=z&&z.search_type,E=z&&z.getElementsByTagName("label")[0],D=z&&z.cat,S=g("J_TSearchTabs").getElementsByTagName("li"),v=S.length,P={},I=false,F=false,y="tsearch-tabs-active",N=function(Y){for(var X=0;X<v;X++){i[X===Y?"addClass":"removeClass"](S[X],y)}},R=g("J_TSearchCat"),U=null,w=g("J_TSearchCatHd"),A=R&&R.getElementsByTagName("div")[0],C=A&&A.getElementsByTagName("a")||[],H=C.length,Q,G=function(X){for(Q=0;Q<H;Q++){if(C[Q].getAttribute("data-value")===X){return C[Q]}}return null},M=function(){i.removeClass(R,"tsearch-cat-active")},T=function(){i.addClass(R,"tsearch-cat-active")},L=function(X){for(Q=0;Q<H;Q++){i[C[Q]===X?"addClass":"removeClass"](C[Q],"tsearch-cat-selected")}M();
w.innerHTML=X.innerHTML;
D.value=X.getAttribute("data-value")},J=function(){K.focus();if(o){K.value=K.value}};
if(!z){return}if(g("J_TSearchTabs")){var O=0,B={"\u5b9d\u8d1d":["item","\u8f93\u5165\u60a8\u60f3\u8981\u7684\u5b9d\u8d1d"],"\u6dd8\u5b9d\u5546\u57ce":["mall","\u8f93\u5165\u60a8\u60f3\u8981\u7684\u5546\u54c1"],"\u5e97\u94fa":["shop","\u8f93\u5165\u60a8\u60f3\u8981\u7684\u5e97\u94fa\u540d\u6216\u638c\u67dc\u540d"],"\u62cd\u5356":["auction","\u8f93\u5165\u60a8\u60f3\u8981\u7684\u5b9d\u8d1d"]};
for(;O<v;O++){(function(){var Z=O,X=i.trim(S[Z].getElementsByTagName("a")[0].innerHTML),Y=B[X];P[Y[0]]={index:Z,hint:Y[1]};
i.addEvent(S[Z],"click",function(aa){i.stopEvent(aa);
N(Z);x.value=Y[0];E.innerHTML=Y[1];J()})})()}}i.addEvent(K,"focus",function(){E.innerHTML=""});
i.addEvent("J_TSearchTabs","mousedown",function(){I=true;F=true;setTimeout(function(){I=false})});
i.addEvent(z,"submit",function(){switch(z.search_type.value){case"item":z.action=K.value===""?m:"http://search.taobao.com/search";break;
z.filterFineness.value="1,3";break}});
E.innerHTML="";setTimeout(function(){if(!F){x.value=(V&&V.searchType)?V.searchType:"item";if(document.domain.indexOf("shopsearch.taobao.com")>-1){x.value="shop"}var X=P[x.value];
E.innerHTML=X.hint;N(X.index)}if(R&&(U=G(D.value))){L(U)}if(i.trim(K.value)!==""){E.innerHTML=""}if(V&&V.autoFocus){J()}z.atype.value="";
z.filterFineness.value=""})}function b(C){var z=g(C);if(!z){return}var A=z.q;
var B=z.ssid;if(B){setTimeout(function(){B.value="s5-e"},0);B.setAttribute("autocomplete","off");
w.subscribe("onItemSelect",function(){if(B.value.indexOf("-p1")==-1){B.value+="-p1"}})}var x=z.elements.search_type;var v=function(){return x.value};

w._needUpdate=function(){var D=v();return(D==="item"||D==="mall")&&y.call(w)}}function n(v){var w=g(v);

y.appendChild(x)}return{init:function(w){if(l){var v=i.getElementsByClassName("menu","div","site-nav",function(){a(this)})}h();c();u();n("J_Logout");

}}}();